<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    p {
      font-size: 16px;
    }
    p:has(span) {
      /* 有span的p标签，颜色改为红色 */
      color: red;
    }
  </style>
</head>
<body>
  <p>
    123
  </p>
  <p>
    <span>
      我是span
    </span>
  </p>
</body>
</html>